/* The literal class is used to identify if the token is a real lit, an int lit, or a string lit.  It is used to tokenizer. */

#include <iostream>
#include "Literal.h"


// Public Functions:

//Literal constructor is used to create a litType
Literal::Literal(LiteralType litType) {type = litType;}

//SetValues are used to set the value of string, int and float
void Literal::SetValue(int x) {value.integer = x; }

void Literal::SetValue(float x) {value.real = x; }

void Literal::SetValue(string s) {

	for(int i = 0; i < MAX_TOKEN_STRING_LENGTH; i++)
		value.str[i] += s.at(i);

}

//GetStringValue is used to return the value of the string
string Literal::GetStringValue() {return value.str; }

//GetIntValue is used to return the value of the int
int Literal::GetIntValue() {return value.integer; }

//GetFloatValue returns the value of the real number
float Literal::GetFloatValue() { return value.real; }

//GetType returns the type 
LiteralType Literal::GetType() { return type; }

//Literal desconstructor
Literal::~Literal() {}


// Private Functions:

//Literaly Type determines the type of the literal
LiteralType type;
    union myUnion
    {
        int integer;
        float real;
        char str[MAX_SOURCE_LINE_LENGTH];
    }
    value;
